package com.dp.mallchat.common.common.event.listener;

import com.dp.mallchat.common.common.event.BlackEvent;
import com.dp.mallchat.common.user.dao.BlackDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @Author: dupeng
 * @CreateTime: 2024-06-13  17:10
 * @Description: 黑名单事件监听
 */
@Service
public class BlackEventListener {

    @Autowired
    private BlackDao blackDao;


    @Async
    @EventListener(classes = BlackEvent.class)
    public void blackEvent(BlackEvent blackEvent) {
        // 清除缓存
        blackDao.blackListEvict();
    }


}
